<!DOCTYPE html>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<c:set var="contextPath" value="${pageContext.request.contextPath}" />
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>文章浏览记录列表页</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<meta content="width=device-width, initial-scale=1" name="viewport">
<link rel="stylesheet" type="text/css" href="${contextPath}/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="${contextPath}/css/bootstrap-theme.min.css" />
<link rel="stylesheet" type="text/css" href="${contextPath}/css/public.css">
<script type="text/javascript" src="${contextPath}/js/jquery.min.js"></script>
<script type="text/javascript" src="${contextPath}/js/bootstrap.min.js"></script>
<script type="text/javascript" src="${contextPath}/js/common.js"></script>
<style type="text/css">
	.popover{
		max-width:none;
	}
</style>
</head>
<body>
	<jsp:include page="../head.jsp" />
	<div class="container">
		<div class="panel panel-default" id="articleOpenLogList">
			<div class="panel-heading">文章浏览记录列表</div>
			<div class="panel-body">
				<table style="table-layout: fixed;" class="table table-striped table-bordered">
					<thead>
						<tr>
							<th style="width: 5%">序号</th>
							<th style="width: 40%">标题</th>
							<th style="width: 20%">浏览时间</th>
							<th style="width: 10%">浏览人</th>
						</tr>
					</thead>
					<tbody id = "articleOpenLogList-tbody"></tbody>
				</table>
			</div>
			<ul class="pagination"></ul>
		</div>
	</div>
<script type="text/javascript">
	$(document).ready(function () {
		articleOpenLogList(1);
	});
	articleOpenLogList = function (pageNum) {
		$.ajax({
			type: 'POST',
			url: '${contextPath}/security/getAllArticleOpenLogListForOverView',
			data: {"page": pageNum},
			dataType: 'json',
			success: function (data) {
//				articleId, title, createUser, releaseTime, openTime 
				if (data.list == "") {
					$("#articleOpenLogList-tbody").empty();
					$("#articleOpenLogList-tbody").append("<tr class='text-danger'><td colspan='4'>无内容</td></tr>");
					var pageDom = $("#articleOpenLogList .pagination");
					pageDom.empty();
				} else {
					$("#articleOpenLogList-tbody").empty();
					$.each(data.list,function (i, item) {
						$("#articleOpenLogList-tbody").append(
							"<tr>"+
								 "<td>" + (i + 1) + "</td>" + 
								 "<td class='titleTd'><a href='${contextPath}/security/showArticleContent?id=" + item.articleId + "' target='_blank'>" + item.title + "</a></td>" + 
								 "<td>" + item.openTime + "</td>" + 
								 "<td>" + item.openUser + "</td>" + 
							"</tr>"
						);
	
					});
					var pageDom = $("#articleOpenLogList .pagination");
					pageDom.empty();
					pucPageTotle = data.totlePage;
					page.creatPageHTML(pageNum, pucPageTotle, pageDom, "articleOpenLogList");
					$("#articleOpenLogList .pageGoBtn").click(function () {
						var pageNum = 0;
						pageNum = $("#articleOpenLogList .pageGoText").val();
						if (pageNum != 0 && 0 < pageNum && pageNum < pucPageTotle + 1) {
							loadUnCompletePackList(pageNum);
						}
					});
				}
				$('[data-toggle="popover"]').popover();
				$(".popover").css("max-width","none");
			}
		});
	};
</script>
</body>
</html>
